﻿@{
    ViewBag.Title = "登录日志";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">登录日志列表</h3>
                <div class="box-tools">
                    <div class="input-group" style="width: 250px;">
                        <input type="text" class="form-control input-sm" placeholder="请输入名称进行模糊查询...">
                        <div class="input-group-btn">
                            <a class="btn btn-sm btn-default"><i class="fa fa-search"></i></a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-body no-padding">
                <div class="mailbox-controls">
                    <div class="btn-group" id="partial_button_toolbar">
                        @{ Html.RenderPartial("~/Areas/Common/Views/Shared/_PartialButton.cshtml"); }
                    </div>
                    <a data-toggle="tooltip" title="刷新" class="btn btn-default btn-sm"><i class="fa fa-refresh">刷新</i></a>
                </div>
                <div class="mailbox-jqgrid">
                    <table id="list"></table>
                    <div id="pager"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var $grid,
        height;

    //初始化表格
    function initGird() {
        $grid = $("#list").jgridview(
        {
            loadonce: false,
            shrinkToFit: true,
            url: '/System/Log/GetPagingLoginLog',
            colModel: [
                { name: "LoginLogId", hidden: true },
                { label: "登录名", name: "CreateUserCode", width: 130 },
                { label: "真实姓名", name: "CreateUserName", width: 100 },
                { label: "登录时间", name: "LoginTime", align: "center", fixed: true, width: 120, formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }, formatter: 'date' },
                { label: "退出时间", name: "LoginOutTime", align: "center", width: 120, fixed: true, formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }, formatter: 'date' },
                { label: "停留时间(小时)", name: "StandingTime", width: 100 },
                { label: "客户端IP", name: "ClientHost", width: 150 },
                { label: "参考地址", name: "IpAddressName", width: 150 },
                //{ label: "服务器", name: "ServerHost", width: 150 },
                { label: "浏览器信息", name: "UserAgent", width: 150 },
                { label: "操作系统", name: "OsVersion", width: 100 }
            ],
            sortname: "CreateTime",
            height: height,
            sortorder: "desc"
        });
    }

    //删除匹配项
    function del(ids) {
        $.post('/Log/DeleteBatchExceptionLog', { ids: ids }, function (data) {
            getGridData();
        });
    }
    $(function () {
        height = UtilWindowHeightWidth().WinH - 319;
        initGird();
        $('#datepicker').datepicker({
            autoclose: true
        });
    });
</script>